package com.neusoft.demo.repository;

import com.neusoft.demo.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

public interface UserRepository extends JpaRepository<User, Long> {

    @Transactional
    @Modifying
    @Query(value = "update `user` c set c.`name`=? where `id`=?", nativeQuery = true)
    int updateNameById(String name, Long id);
}
